home *** CD-ROM | disk | FTP | other *** search
- #include <graphics.h>
- #include <conio.h>
-
- main()
- {
- int errorcode;
- int graphdriver = DETECT;
- int graphmode;
-
- /* Detect and initialize graphics system */
- initgraph(&graphdriver, &graphmode, "c:\\turboc");
-
- settextjustify(CENTER_TEXT, CENTER_TEXT);
- settextstyle(SANS_SERIF_FONT, HORIZ_DIR, 1);
- outtextxy( getmaxx() / 2, getmaxy() / 2, "You are in graphics mode now...");
- outtextxy(getmaxx()/2, getmaxy() - 50, "Press any key to switch to text mode");
- getch();
- /* Switch to text mode */
- restorecrtmode();
- gotoxy(20,1);
- cputs("Press any key to return to graphics mode...");
- getch();
- /* Back to graphics mode again */
- setgraphmode(graphmode);
- outtextxy( 10, getmaxy() / 2, "Graphics mode again. Notice everything's reset.");
- outtextxy(getmaxx()/2, getmaxy() - 50, "Press any key to exit:");
- getch(); /* Wait until a key is pressed */
- closegraph(); /* Exit graphics library */
- }